﻿using FairyGUI;

/// <summary>
/// 主界面用户信息
/// </summary>
public class UIHome_PlayerInfo {

    GComponent _comp;
    UIHeadpicImage _headImg;
    GTextField _nameCtrl;
	GTextField _idCtrl;
    GTextField _cardCtrl;


    public UIHome_PlayerInfo(GComponent comp)
    {
        _comp = comp;

        _headImg = new UIHeadpicImage(_comp.GetChild("头像").asCom, ()=> {
            DebugInfo.Log("头像被点击");
            UIHome_PersonDetails.Popup();
        });
        _nameCtrl = _comp.GetChild("名字").asTextField;
		_idCtrl = _comp.GetChild("编号").asTextField;
        _cardCtrl = _comp.GetChild("房卡").asTextField;

        _headImg.SetHeadpic(DataKernel.inst.userInfo.headpic);
        _nameCtrl.text = DataKernel.inst.userInfo.name;
		_idCtrl.text = "ID：" + DataKernel.inst.userInfo.uid;
        _cardCtrl.text = "房卡：" + DataKernel.inst.userInfo.card + "张";
    }
}
